package oa.hleast.xswl.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import oa.hleast.xswl.pojo.domain.CmsVenueMain;
import oa.hleast.xswl.pojo.vo.ManagerSignInVenuesVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author: 302
 * @date: 2021-07-05 15:14:30
 * @description: 场馆主表(CmsVenueMain)Mapper
 */
@Mapper
public interface CmsVenueMainMapper extends BaseMapper<CmsVenueMain> {

    @Select("select v.id venueId,v.venue_name venueName,v.main_image_url mainImagerUrl,v.address as address,s.user_id userId,s.id signInId,s.schedule_start_date as scheduleStartDate, s.schedule_end_date scheduleEndDate" +
            " from (" +
            "    select * from cms_venue_sign_in where user_id = #{userId} and sign_in_status = #{signInStatus} and review_status = #{reviewStatus} and deleted = 0  " +
            ") s left join (" +
            "    select * from cms_venue_main where manager_user_id = #{managerUserId} and deleted = 0 " +
            ") v on v.id = s.venue_main_id ")
    List<ManagerSignInVenuesVo> listByUserIdForManager(Long userId, Long managerUserId, Integer signInStatus, Integer reviewStatus);
}
